# 登录
def ihrm_longin_assert(res_longin, exp1, exp2, exp3, exp4):
    assert res_longin.status_code == exp1
    assert res_longin.json()["success"] == exp2
    assert res_longin.json()["code"] == exp3
    assert exp4 in res_longin.json()["message"]


# 添加
def ihrm_add_assert(res_add, exp1, exp2, exp3, exp4, exp5):
    assert res_add.status_code == exp1
    assert res_add.json()["success"] == exp2
    assert res_add.json()["code"] == exp3
    assert exp4 in res_add.json()["message"]
    # 当接收到的departmentId的预期值exp5 不为 None的时候，才进行断言
    if exp5 is not None:
        assert res_add.json()["data"]["departmentId"] == exp5


# 查询
def ihrm_query_assert(res_query, exp1, exp2, exp3, exp4, exp5):
    assert res_query.status_code == exp1
    assert res_query.json()["success"] == exp2
    assert res_query.json()["code"] == exp3
    assert exp4 in res_query.json()["message"]
    if exp5 is not None:
        assert res_query.json()["data"]["id"] == exp5


# 修改
def ihrm_amend_assert(res_amend, exp1, exp2, exp3, exp4, exp5):
    assert res_amend.status_code == exp1
    assert res_amend.json()["success"] == exp2
    assert res_amend.json()["code"] == exp3
    assert exp4 in res_amend.json()["message"]
    # 当接收到的id的预期值exp5 不为 None的时候，才进行断言
    if exp5 is not None:
        assert res_amend.json()["data"]["username"] == exp5


# 删除
def ihrm_assert_delete(res_delete, exp1, exp2, exp3, exp4):
    assert res_delete.status_code == exp1
    assert res_delete.json()["success"] == exp2
    assert res_delete.json()["code"] == exp3
    assert exp4 in res_delete.json()["message"]


# 管理列表
def assert_manage_list(res_manage, exp1, exp2, exp3, exp4):
    assert res_manage.status_code == exp1
    assert res_manage.json()["success"] == exp2
    assert res_manage.json()["code"] == exp3
    assert exp4 in res_manage.json()["message"]



